import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '@/views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/home' // 重定向默认Price页为主页，且路由为/home
  },
  {
    path: '/home',
    name: 'Home',
    component: Home,
    children: [
      // 主页区块
      {
        path: '/home',
        component: () => import('@/pages/Price.vue'),
        children: [
          {
            path: '/home',
            component: () => import('@/home-tab/home-trend.vue')
          },
          {
            path: '/home/review',
            component: () => import('@/home-tab/home-review.vue')
          },
          {
            path: '/home/rank',
            component: () => import('@/home-tab/home-rank.vue')
          },
          {
            path: '/home/topics',
            component: () => import('@/home-tab/home-topics.vue')
          },
          {
            path: '/home/purchase',
            component: () => import('@/home-tab/home-purchase.vue')
          },
        ]
      },
      {
        path: '/achievement',
        component: () => import('@/pages/Achievement.vue')
      },
      {
        path: '/community',
        component: () => import('@/pages/Community.vue')
      },
      {
        path: '/follow',
        component: () => import('@/pages/Follow.vue')
      },
      {
        path: '/self',
        component: () => import('@/pages/Self.vue')
      },
      
      // 游戏区块
      {
        path: '/games',
        component: () => import('@/games/game-all.vue'),
      },
      {
        path: '/games/detail',
        component: () => import('@/games/game-detail.vue'),
      },
      {
        path: '/games/search',
        component: () => import('@/games/game-search.vue'),
      },
      {
        path: '/games/vip',
        component: () => import('@/games/game-vip.vue'),
      },
      {
        path: '/games/newgames',
        component: () => import('@/games/game-new.vue'),
      },
      {
        path: '/games/passgames',
        component: () => import('@/games/game-pass.vue'),
      },
      {
        path: '/games/zhgames',
        component: () => import('@/games/game-zh.vue'),
      },
      {
        path: '/games/disgames',
        component: () => import('@/games/game-disgames.vue'),
      },
      {
        path: '/games/disdlc',
        component: () => import('@/games/game-disdlc.vue'),
      },
      {
        path: '/games/freegames',
        component: () => import('@/games/game-free.vue'),
      },
      {
        path: '/games/pregames',
        component: () => import('@/games/game-pre.vue'),
      },
    ]
  },
  {
    path: '/login',
    name: 'Login',
    component: () => import('@/views/Login.vue')
  }
]

const router = new VueRouter({
  routes
})

export default router
